home *** CD-ROM | disk | FTP | other *** search
- * Printing an invoice
- procedure INVOUT
- parameters PINVNO
- private PC, PT, DOIT
- PC = chr(18)+chr(15)
- PT = chr(27)+":"
- DOIT = .t.
-
- if QBPROMPT("Printer Loaded and Online|Quit|")<>1
- return
- endif
- if PINVNO=0
- do QBMESS with "Serious program error - how the hell did we get here?",colflash,15
- endif
-
- do while DOIT
- select PARTLINE
- go top
- NLOOPS = max(int(ceiling(reccount()/33)),1)
-
- select INVOICE
- do QBPRCTL with "P"
- if GETOUT
- return
- endif
- for I=1 to NLOOPS
- do QBTXTMAC with "IVFORMAT.TXT"
- if NLOOPS>I
- if QBYESNO("More to do - Ready with next Sheet?")="N"
- exit
- endif
- endif
- next
- do QBPRCTL with "R:Invoice printed"
- DOIT = (QBYESNO("Print this Invoice again?")="Y")
- enddo
- return
-
- ******************************************************************
-
- procedure QBTXTMAC
- * uses clipper file reading facilities and
- * Tom Rettig function atnext()
-
- PARAMETERS fname
- PUBLIC partplen
- PRIVATE buffer, occ, opos, npos, macline
- partplen = 61
- set alternate to invtrace.txt
- set alternate on
- if file(fname)
- buffer = memoread(fname)
- else
- do QBMESS with "Format file for Invoice missing",COLFLASH,10
- return
- endif
-
- store 1 to occ, opos, npos
- DO WHILE .T.
- npos = atnext(chr(13),buffer,occ)
- IF npos=0
- EXIT
- ENDIF
- macline = substr(buffer,opos,npos-opos)
- do case
- case substr(macline,1,1)="*"
- set print off
- do QBMESS with substr(macline,2),COLHEAD,0
- set print on
- case substr(macline,1,1)="?"
- macline = substr(macline,2)
- ?? &macline
- otherwise
- ? &macline
- endcase
- opos = npos + 2
- occ = occ + 1
- ENDDO
-
- set alternate off
- set alternate to
- RETURN
-
- ******************************************************************
-
- function PRPART
- * XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 99 9999.99 9999.99
- private PSTR
- PSTR = "" && chr(18)+chr(15) && Set compressed
- select PARTLINE
- if eof()
- PSTR = space(PARTPLEN)
- else
- PSTR = PSTR+PARTDESC+str(QTY,2)+space(1)+str(UPRICE,7,2)+space(4)+str(TPRICE,7,2)
- PARTPLEN = len(PSTR)
- skip
- endif
- select INVOICE
- return PSTR && +chr(27)+":" && and set 12CPI